<?php
// +----------------------------------------------------------------------
// | 测试
// +----------------------------------------------------------------------
// | Author: cart <469714167@qq.com>
// +----------------------------------------------------------------------
// | Datetime: 201-02-01 09:43:00
// +----------------------------------------------------------------------
// | Copyright: 微量科技
// +----------------------------------------------------------------------
namespace app\qianyu\controller;


use app\dv1\model\Shop;
use think\Controller;
use think\Validate;
use think\Db;
use org\BaiduMap;
use think\Model;
use think\Loader;
use org\HMongodb;

class Test extends Controller
{
    public function test()
    {
    $host = "http://jisuqgclwz.market.alicloudapi.com";
    $path = "/illegal/query";
    $method = "GET";
    $appcode = "你自己的AppCode";
    $headers = array();
    array_push($headers, "Authorization:APPCODE " . $appcode);
    $querys = "carorg=hangzhou&engineno=123456&frameno=229561&iscity=0&lsnum=AH5b57&lsprefix=%E6%B5%99&lstype=02&mobile=mobile";
    $bodys = "";
    $url = $host . $path . "?" . $querys;

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_FAILONERROR, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, true);
    if (1 == strpos("$".$host, "https://"))
    {
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    }
    var_dump(curl_exec($curl));
    exit;
        return ['data' => '', 'code' => 400, 'msg' => '测试', 'status' => false];
    }

    /* 生成订单号 */
    public function generate()
    {
        return $order = date('Ymd') . substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
    }

    public function testshop()
    {
        $shop = new Shop();
        // $list = $shop->setTable('tp_users')->page(1, 5)->select();
        $arr = [3652,4371];
        $a = Db::table('slzd_user')
        // ->where('companyLogId', $log_id)
        // ->where('id','in',[1,5,80,50])
        ->field('point')
        ->whereIn('id',$arr)
        ->select();
        $b = Db::table('slzd_order_rrb')
        ->field('base_price')
        ->where('status',5)
        ->whereIn('id',$arr)
        ->select();
        $sql = 'select sum(base_price) base_price from slzd_order_rrb  where status = 5 and uid = 3652' ;
        $b = Db::query($sql);
        dump($b);
        exit;
        // $sql = 'UPDATE tp_users set ';
        $list = $shop->Settable('tp_users')->field('user_money')->whereIn('cid',$arr)->select();
        dump($list);
        echo Db::getLastSql();
        echo $shop->getLastSql(); 
        exit;
        px($list);
        exit;
    }

}